package com.jjm.entidades;

import java.util.ArrayList;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable(detachable="true",identityType = IdentityType.APPLICATION)
public class Candidato { 
	  
	public Candidato() {} 
	
	public Candidato(String key,String firstName,String apellidos,String email,String password,int status,Photo photo,String city,String stateOrProvince,String phone) {
		this.key=key;
		this.firstName = firstName;
		this.apellidos = apellidos;
		this.email = email;
		this.password = password;
		this.status = status;
		this.photo = photo;
		this.city = city;
		this.stateOrProvince = stateOrProvince;
		this.phone = phone;
		
	}
	
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
    private String key; 

    @Persistent
    private String firstName;

    @Persistent
    private String apellidos;

    @Persistent
    private String email;
    
    @Persistent
    private String password;
    
    @Persistent
    private int status;
    
    @Persistent(defaultFetchGroup = "true")
    private Photo photo;
    
    @Persistent
    private String city;
    @Persistent
    private String stateOrProvince;
    @Persistent
    private String phone;
    
    @Persistent(mappedBy = "usuario",defaultFetchGroup = "true")
    ArrayList<Curriculum> cvs;
    
    @Persistent(mappedBy = "usuario",defaultFetchGroup = "true")
    ArrayList<Busqueda> busquedas; 

	public ArrayList<Busqueda> getBusquedas() {
		return busquedas;
	}

	public void setBusquedas(ArrayList<Busqueda> busquedas) {
		this.busquedas = busquedas;
	}

	public void getKey(String key) {
		this.key = key;
	}

	public String getKey() {
		return key;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getApellidos() {
		return apellidos;
	}

	public void setApellidos(String apellidos) {
		this.apellidos = apellidos;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPassword() {
		return password;
	}
	
	public String getPasswordconf() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Photo getPhoto() {
		if(photo != null) {
			photo.getImage();
			photo.getThumbnail();
		}
		return photo;
	}

	public void setPhoto(Photo photo) {
		this.photo = photo;
	}

	public ArrayList<Curriculum> getCvs() {
		return cvs;
	}

	public void setCvs(ArrayList<Curriculum> cvs) {
		this.cvs = cvs;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public int getStatus() {
		return status;
	}
	
	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getStateOrProvince() {
		return stateOrProvince;
	}

	public void setStateOrProvince(String stateOrProvince) {
		this.stateOrProvince = stateOrProvince;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getPhone() { 
		return phone;
	}
   
	//Redefinimos el toString
	public String toString()
	{
		return this.firstName + " " + this.apellidos;
	    }
    
}